{include file="public/header" /}
<link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css" />
<style>
    .bbbmmm{
        margin-top: 330px;
    }
    #container{
        height: 350px;
    }
    .layui-form-item{
        margin-bottom: 0;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">案例名字：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.case_name}" name="case_name" lay-verify="required" placeholder="案例名字" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">案例地址：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.case_address}" name="case_address" lay-verify="required" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">案例情况：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.case_info}" name="case_info" lay-verify="required" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">客户名字：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.case_username}" name="case_username" lay-verify="required" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">客户电话：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.case_phone}" name="case_phone" lay-verify="required" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">导入人员：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.case_excel}" name="case_excel" lay-verify="required" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">人员联系方式：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$info.case_excel_phone}" name="case_excel_phone" lay-verify="required" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所属业务人员：</label>
                            <div class="layui-input-block">
                                <select name="case_excel_uids" xm-select="select1" lay-verify="required" xm-select-search="" xm-select-search-type="dl">
                                    {volist name='users' id='t'}
                                    <option value="{$t.user_id}" {if in_array($t.user_id,$info.case_excel_uids)}selected{/if}>{$t.user_username}({$t.user_phone})</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">面积</label>
                            <div class="layui-input-block">
                                <input type="number" value="{$info.case_size}" name="case_size" maxlength="6" class="layui-input" lay-verify="number" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">选择空间：</label>
                            <div class="layui-input-block">
                                <select name="case_room"  lay-search="" id="types">
                                    {volist name='room' id='t'}
                                    <option value="{$t.room_id}" {if $info.case_room==$t.room_id}selected{/if}>{$t.room_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">选择风格：</label>
                            <div class="layui-input-block">
                                <select name="case_style"  lay-search="" id="type_pps" lay-verify="required">
                                    {volist name='style' id='pp'}
                                    <option value="{$pp.style_id}" {if $info.case_style==$pp.style_id}selected{/if}>{$pp.style_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">选择区域：</label>
                            <div class="layui-input-block">
                                <select name="case_qu"  lay-search="" lay-verify="required">
                                    {foreach name='qus' item="q"}
                                    <option value="{$q.district_id}" {if $info.case_qu==$q.district_id}selected{/if}>{$q.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <!--====================================================================================-->
                        <!--====================================================================================-->
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8" id="image_1">
                            <label class="layui-form-label">轮播图：</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del" value="">
                                <input type="hidden" id="hid" value="{$info.case_banner}">
                                <input type="hidden" value="{$info.case_banner}" name="case_banner" id="photo" lay-verify="image">
                                <div id="uploader" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker"></div>
                                            <p>或将图片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">案例视频：</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del2" value="">
                                <input type="hidden" id="hid2" value="{$info.case_video}">
                                <input type="hidden" value="{$info.case_video}" name="case_video" id="photo2" lay-verify="image">
                                <div id="uploader2" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker2"></div>
                                            <p>或将图片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker2" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">推广图片2张：</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del3" value="">
                                <input type="hidden" id="hid3" value="{$info.case_two_pic}">
                                <input type="hidden" value="{$info.case_two_pic}" name="case_two_pic" id="photo3" lay-verify="image">
                                <div id="uploader3" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker3"></div>
                                            <p>或将图片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker3" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">案例相册：</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del4" value="">
                                <input type="hidden" id="hid4" value="{$info.case_imgs}">
                                <input type="hidden" value="{$info.case_imgs}" name="case_imgs" id="photo4" lay-verify="image">
                                <div id="uploader4" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker4"></div>
                                            <p>或将图片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker4" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">现场照片：</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del5" value="">
                                <input type="hidden" id="hid5" value="{$info.case_photo}">
                                <input type="hidden" value="{$info.case_photo}" name="case_photo" id="photo5" lay-verify="image">
                                <div id="uploader5" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker5"></div>
                                            <p>或将图片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker5" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--====================================================================================-->
                        <!--====================================================================================-->
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">获取经纬度：</label>
                            <div class="layui-input-block">
                                <div id="container"></div>
                                <div id="myPageTop">
                                    <table>
                                        <tr>
                                            <td>
                                                <label>请输入关键字：</label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input id="tipinput" type="text" />
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 bbbmmm">
                            <label class="layui-form-label">经纬度值：</label>
                            <div class="layui-input-block">
                                <div class="one flex-wrap underLine">
                                    <input type="text" value="{$info.case_lat},{$info.case_lon}" name="lonlat" id="lonlat" class="layui-input" lay-verify="required" placeholder="请点击地图上的位置获取经纬度" readonly>
                                </div>
                            </div>
                        </div>
                        <div style="clear: both"></div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">排序值</label>
                            <div class="layui-input-block">
                                <input type="number" placeholder="值越大越靠前" value="{$info.case_sort}" name="case_sort" maxlength="11" class="layui-input" lay-verify="number" >
                            </div>
                        </div>
                        <input type="hidden" value="{$info.case_id}" name="case_id">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script src="https://webapi.amap.com/maps?v=1.4.15&key=3108d268226b46915b5faa028a004245&plugin=AMap.Geocoder,AMap.Autocomplete,AMap.PlaceSearch"></script>
<script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
<script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
<script>
    var n = wk.uploads({num:20,type:'png,jpg,jpeg',url:"{:url('admin/upload/upload')}",status:'update'}); //图片
    function imgDel(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n);
    }
    var n2 = wk.uploads({num:20,attr:2,size:200,type:'mp4,MP4,Mp4,mP4',url:"{:url('admin/upload/upload')}",mwwadd:2,status:'update'}); //视频
    function imgDel2(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n2);
    }
    var n3 = wk.uploads({num:2,attr:3,type:'png,jpg,jpeg',url:"{:url('admin/upload/upload')}",status:'update'}); //图片
    function imgDel3(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n3);
    }
    var n4 = wk.uploads({num:50,attr:4,type:'png,jpg,jpeg',url:"{:url('admin/upload/upload')}",status:'update'}); //图片
    function imgDel4(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n4);
    }
    var n5 = wk.uploads({num:50,attr:5,type:'png,jpg,jpeg',url:"{:url('admin/upload/upload')}",status:'update'}); //图片
    function imgDel5(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n5);
    }
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('newEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                            wk.layer_close();
                        })
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>
</body>
</html>

<script type="text/javascript">

    /**
     * 地图加载
     * @type {AMap.Map}
     */
    var map = new AMap.Map("container", {
        resizeEnable: true
    });
    //输入提示
    var autoOptions = {
        input: "tipinput"
    };
    var auto = new AMap.Autocomplete(autoOptions);
    var placeSearch = new AMap.PlaceSearch({
        map: map,
//        pageSize:1
    });
    //构造地点查询类
    AMap.event.addListener(auto, "select", select);//注册监听，当选中某条记录时会触发
    function select(e) {
        placeSearch.setCity(e.poi.adcode);
        placeSearch.search(e.poi.name);  //关键字查询查询
        //搜索结果一出来就先获取经纬度
//        var lng = e.poi.location.lng;   //获取经度
//        var lat = e.poi.location.lat;
//        document.getElementById("lonlat").value = lat + ',' + lng;
//        map.clearMap();
    }
    //点击marker获取经纬度（和地图上点的取值方式不一样，所以单独设置）
    AMap.event.addListener(placeSearch, "markerClick", markerAddGetLnla);
    function markerAddGetLnla(e) {
        document.getElementById("lonlat").value = e.data.location.lat + ',' + e.data.location.lng;
        addChoiseMark(e.data.location.lng,e.data.location.lat);
    }
    function addChoiseMark(lng,lat) {
        if(lng && lat){
            map.clearMap();
            var marker = new AMap.Marker({
//                icon: "__IMG__/pause.png",
                position: [lng, lat]
            });
            map.add(marker);
        }
    }
    /**
     * 点击地图获取经纬度
     */
    //为地图注册click事件获取鼠标点击出的经纬度坐标
    map.on('click', function(e) {
        document.getElementById("lonlat").value = e.lnglat.getLat() + ',' + e.lnglat.getLng();
        addChoiseMark(e.lnglat.getLng(),e.lnglat.getLat());
    });
</script>